// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/efficiency/api/EnergyOverviewApi'

import InfoClass from '@api/efficiency/model/SubItemStatisticReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 信息 —————————————————————————————— //

  async getInfo(param, TIP = '查询分项用能') {
    const DTO = CORE.grpcDTO(InfoClass, param)
    const resp = await CORE.grpc(TIP, CLIENT, 'subItemStatistic', DTO)
    return resp.content || []
  },
  transInfo(obj) {
    const keys = Object.keys(obj || {})
    return {
      xData: keys,
      dataList: keys.map((key) => obj[key]),
    }
  },
}
